<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<!-- import CSS -->
		<script src="../../js/commonCss.js"></script>
		<title>继续教育-考核管理</title>
	</head>
	<body>
		<div id="app" v-cloak>
			<div class="pd10 border-bottom ft-14 h40">				
				<a href="educationBatch.html">
					<el-button type="text" icon="el-icon-arrow-left">继续教育-考核管理</el-button>
				</a>
				<el-button class="f-r" type="primary" icon="el-icon-plus" @click="addCont">添加视频</el-button>
			</div>
			<div class="pd10">		
				<el-form :inline="true" :model="formInline" class="demo-form-inline">					
					<el-form-item>
						<el-input v-model="formInline.title" type="text" placeholder="标题"></el-input>
					</el-form-item>
					<el-form-item>
						<el-select v-model="formInline.typeId" placeholder="类别">
							<el-option :label="item.etypeTitle" :value="item.etypeId" v-for="item in categoryArr" :key="item.etypeId"></el-option>
						</el-select>
					</el-form-item>
					<el-form-item>
						<el-button type="primary" @click="search">查询</el-button>
					</el-form-item>
				</el-form>
				<el-table :data="tableData" stripe border style="width: 100%">
					<el-table-column prop="eeTitle" label="标题"></el-table-column>
					<el-table-column label="缩略图">
						<template slot-scope="scope">
							<img :src="imgBaseUrl+scope.row.eeImg" min-width="92" height="92" />
						</template>
					</el-table-column>
					<!--<el-table-column prop="eeVider" label="视频地址"></el-table-column>-->
					<el-table-column prop="typeName" label="产品类别">
<!--						<template slot-scope="scope">-->
<!--							{{({"1":"专业素养","2":"金融保险","3":"政策法规"}[scope.row.eduType])}}-->
<!--						</template>-->
					</el-table-column>
					<el-table-column prop="eeIsDt" label="是否为投连">
						<template slot-scope="scope">
							{{({"0":"否","1":"是"}[scope.row.eeIsDt])}}
						</template>
					</el-table-column>
					<el-table-column prop="eeTime" label="上传时间"></el-table-column>
					<el-table-column prop="eeScore" label="总分"></el-table-column>
					<el-table-column label="操作">
						<template slot-scope="scope">
							<el-button @click="handleEdit(scope.row)" type="text" size="medium">编辑</el-button>
							<el-button @click="handleDelete(scope.row)" type="text" size="medium" class="color-F56C6C">删除</el-button>
						</template>
					</el-table-column>
				</el-table>				
				<!-- 分页 -->
				<div class="bottomstate">
					<el-pagination class="f-r mt5" background @current-change="handleCurrentChange" :current-page="page" :page-size="limit" layout="total,prev, pager, next,jumper"
					 :total="total" ></el-pagination>
				</div>
			</div>
		</div>
	</body>
	<script src="/jeefast/elementui-lib/lib/vue.js"></script>
	<script src="/jeefast/elementui-lib/lib/index.js"></script>
	<script src="/jeefast/js/jquery-1.9.1.min.js"></script>
	<script src="/jeefast/js/axios.js"></script>
	<script src="/jeefast/js/data.js"></script>
	<script>
		var app = new Vue({
			el: "#app",
			mixins: [mix],
			data: function() {
				return {
					etId:"",
					imgBaseUrl:'http://www.u-banker.net/',
					formInline:{
						title:"",
						typeId:""
					},
					categoryArr:[],
					tableData: [],	
					total:0
				}
			},
			methods: {
				geteduTypeList:function(){
					eduTypeList({}).then(res=>{
						if(res.data.code==0){
							this.categoryArr = res.data.data
						}
					})
				},
				search:function(){
					console.log(this.formInline)
					this.getTable();
				},
				// 添加
				addCont:function(){
					window.location.href = 'educationCont.html?etId='+this.etId;//此处拼接内容
				},
				// 删除
				handleDelete:function(row){
					let that = this
					that.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
						confirmButtonText: '确定',
						cancelButtonText: '取消',
						type: 'warning'
					}).then(() => {
						deleteExam({id:row.eeId}).then(res=>{
							that.$message({
								type: 'success',
								message: '删除成功!'
							});
							that.getTable();
						})
					}).catch(() => {
						that.$message({
							type: 'info',
							message: '已取消删除'
						});          
					});
				},
				handleEdit:function(row){
					window.location.href = 'educationCont.html?eeId='+row.eeId+'&etId='+this.etId;//此处拼接内容
				},
				onSubmit:function(){
					console.log(this.form)
				},
				getTable:function(){
					examList({
						typeId:this.formInline.typeId,
						title:this.formInline.title,
						etId:this.etId,
						page: this.page, //起始页面
						limit: this.limit, //每页显示个数
					}).then(res=>{
						console.log("+++")
						console.log(res.data)
						if(res.data.code==0){
							console.log(res);
							this.tableData=res.data.data.list
							this.total=res.data.data.count
							let newArr=JSON.parse(res.data.data.list[0].eeQuestions)
							console.log(newArr.questions)
						}
					})
				}
			},
			created() {
				this.geteduTypeList()
				this.etId = getQueryString("etId");
				this.getTable()
			},
		});
	</script>
</html>
